<?php


class Crb_Settings 
{
	public static function get($Name,$Default = 0)
	{
		$Table = new Zend_Db_Table('settings');
		$select = $Table->select()->where("name=?",$Name);
		$Row = $Table->fetchRow($select);
		if ($Row) 
		{
			return $Row['value'];
		}
		else
		{
			return $Default;
		}
	}
	
	public static function set($Name, $Value)
	{
		$Table = new Zend_Db_Table('settings');
		$select = $Table->select()->where("name=?",$Name);
		$Row = $Table->fetchRow($select);
		if ($Row) 
		{
			$Row->value = $Value;
			$Row->save();
		}
	}
	 
}
